def triangle(n):
    spaces = 2*n #pre-fix spaces
    for i in range(0,n):
        for j in range(0,spaces):
            print(' ',end='')
        spaces -= 1
        for j in range(i + 1):
            print('* ',end='')
        print('\r')

n = 5
triangle(n)